<?php
/**
 * bs多规格sku商城系统
 * ============================================================================
 * 版权所有 2024-2099 wltx666.com，并保留所有权利。
 * 网站地址: https://wltx666.com
 * ============================================================================
 * Author: 草上飞
 * Email: wltx@alipay168.cn
 * QQ: 2719875001
 * Date: 2024/12/26
 * 描述:
 */

namespace app\command;

use app\service\OrderService;
use think\console\Command;
use think\console\Input;
use think\console\input\Option;
use think\console\Output;

class OrderCheck extends Command
{
    protected function configure()
    {
        $this->setName('order_check')
            ->addOption('type', null, Option::VALUE_OPTIONAL, '类型pay')
            ->setDescription('订单检查，默认检查支付超时');
    }

    protected function execute(Input $input, Output $output)
    {

        if ($input->hasOption('type')) {
            $type = $input->getOption('type');
        } else {
            $type = 'pay';
        }

        $output->writeln("当前类型：" . $type);
        if ($type == 'pay') {
            $res = (new OrderService())->pay_expire();
        }
        $output->writeln($res['msg'] ?? '未匹配类型');
    }
}
